﻿#ifndef _FITK_OF_BOUNDARY__H___
#define _FITK_OF_BOUNDARY__H___
 
#include "FITKInterfaceFlowOFAPI.h"
#include "FITK_Kernel/FITKCore/FITKAbstractNDataObject.h"
#include "FITK_Kernel/FITKCore/FITKAbstractDataManager.hpp"
#include "FITKOFEnum.hpp"

namespace Interface
{
    class FITKOFAbsBoundaryType;
    class FITKBoundaryMeshVTK;
    class FITKInterfaceFlowOFAPI FITKOFBoundary : public Core::FITKAbstractNDataObject
    {
        Q_OBJECT
            FITKCLASS(Interface, FITKOFBoundary);
    public:
        explicit FITKOFBoundary(FITKOFSolverTypeEnum::FITKOFBoundaryType bType);
        virtual ~FITKOFBoundary();

        FITKOFSolverTypeEnum::FITKOFBoundaryType getBoundaryType();

        void setMeshBoundaryID(int meshId);
        int getMeshBoundaryID();
        FITKBoundaryMeshVTK* getMeshBoundary();


        int getFlowCount();
        QString getFlowVariableName(int index);
        FITKOFAbsBoundaryType* getFlowVBType(int index);

        int getTurbulenceCount();
        QString getTurbulenceVariableName(int index);
        FITKOFAbsBoundaryType* getTurbulenceVBType(int index);

        int getPhasesCount();
        QString getPhasesVariableName(int index);
        FITKOFAbsBoundaryType* getPhasesVBType(int index);

        void setFlowBoundary(QString variableName, FITKOFAbsBoundaryType* boundaryType);
        void setTurbulenceBoundary(QString variableName, FITKOFAbsBoundaryType* boundaryType);
        void setPhasesBoundary(QString variableName, FITKOFAbsBoundaryType* boundaryType);
        void setBoundary(QString variableName, FITKOFAbsBoundaryType* boundaryType);
        void clearTurbulenceBoundary();

        FITKOFAbsBoundaryType* getBoundary(QString variableName);
    
    private:
        int _meshBoundaryID{ -1 };
        FITKOFSolverTypeEnum::FITKOFBoundaryType _boundaryType{ FITKOFSolverTypeEnum::FITKOFBoundaryType::BNone };
        /**
         * @brief  Flow 里的变量边界信息 <变量名称, 边界类型数据对象>
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-08-26
         */
        QList<QPair<QString, FITKOFAbsBoundaryType*>> _flow{};
        /**
         * @brief  Turbulence 里的变量边界信息 <变量名称, 边界类型数据对象>
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-08-26
         */
        QList<QPair<QString, FITKOFAbsBoundaryType*>> _turbulence{};
        /**
         * @brief  Phases 里的变量边界信息 <变量名称, 边界类型数据对象>
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-08-26
         */
        QList<QPair<QString, FITKOFAbsBoundaryType*>> _phases{};
    };

    class FITKInterfaceFlowOFAPI FITKOFBoundaryManager
        : public Core::FITKAbstractDataManager<FITKOFBoundary>
    {
    public:
        explicit FITKOFBoundaryManager() = default;
        virtual ~FITKOFBoundaryManager() = default;


        QList<FITKOFBoundary*> getBoundarys(FITKOFSolverTypeEnum::FITKOFBoundaryType t);
        /**
         * @brief    根据网格边界ID获取对应的boundary
         * @param[i] boundaryID    网格边界ID
         * @return   FITKOFBoundary*  边界对象
         * @author   BaGuijun (baguijun@163.com)
         * @date     2024-08-26
         */
        FITKOFBoundary* getBoundary(int MeshBoundaryID);
    };

}


#endif
